Asterisk

Asterisk is a software implementation of a telephone private branch exchange (PBX). It allows telephones interfaced with a variety of hardware technologies to make calls to one another, and to connect to telephony services, such as the public switched telephone network (PSTN) and voice over Internet Protocol (VoIP) services.

Available solutions




This template is for Zabbix version: 7.0
Also available for: 6.4 6.2 6.0 5.4

Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/tel/asterisk_http?at=release/7.0

Asterisk by HTTP

Overview

The template for monitoring Asterisk over HTTP that works without any external scripts. It collects metrics by polling the Asterisk Manager API remotely using an HTTP agent and JS preprocessing. All metrics are collected at once, thanks to Zabbix's bulk data collection.

Requirements

Zabbix version: 7.0 and higher.

Tested versions

This template has been tested on:

  • Asterisk, version 13 and later

Configuration

Zabbix should be configured according to the instructions in the Templates out of the box section.

Setup

You should enable the mini-HTTP Server, add the option webenabled=yes in the general section of the manager.conf file and create Asterisk Manager user with system and command write permissions within your Asterisk instance. Disable the PJSIP driver if you do not use PJSIP or do not have PJSIP endpoints. Please, define AMI address in the {$AMI.URL} macro. Also, set the hostname or IP address of the AMI host in the {$AMI.HOST} macro for Zabbix to check Asterisk service status. Then you can define {$AMI.USERNAME} and {$AMI.SECRET} macros in the template for using on the host level. If there are errors, increase the logging to debug level and see the Zabbix server log.

Macros used

Name Description Default
{$AMI.URL}

The Asterisk Manager API URL in the format <scheme>://<host>:<port>/<prefix>/rawman.

http://asterisk:8088/asterisk/rawman
{$AMI.HOST}

The hostname or IP address of the Asterisk Manager API host.

<SET AMI HOST>
{$AMI.PORT}

AMI port number for checking service availability.

5038
{$AMI.USERNAME}

The Asterisk Manager name.

zabbix
{$AMI.SECRET}

The Asterisk Manager secret.

zabbix
{$AMI.TRUNK_REGEXP}

The regexp for the identification of trunk peers.

trunk
{$AMI.RESPONSE_TIME.MAX.WARN}

The Asterisk Manager API page maximum response time in seconds for trigger expression.

10s
{$AMI.QUEUE_CALLERS.MAX.WARN}

The maximum number of callers in a queue for trigger expression.

10
{$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN}

The maximum number of busy channels of a trunk for trigger expression.

28
{$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"PJSIP"}

The total maximum number of busy channels of PJSIP trunks for trigger expression.

28
{$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"SIP"}

The total maximum number of busy channels of SIP trunks for trigger expression.

28
{$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"IAX"}

The total maximum number of busy channels of IAX trunks for trigger expression.

28

Items

Name Description Type Key and additional info
Service status

Asterisk Manager API port availability.

Simple check net.tcp.service["tcp","{$AMI.HOST}","{$AMI.PORT}"]

Preprocessing

  • Discard unchanged with heartbeat: 10m

Service response time

Asterisk Manager API performance.

Simple check net.tcp.service.perf["tcp","{$AMI.HOST}","{$AMI.PORT}"]
Get stats

Asterisk system information in JSON format.

HTTP agent asterisk.get_stats

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Version

Service version

Dependent item asterisk.version

Preprocessing

  • JSON Path: $.version

Uptime

The system uptime expressed in the following format: "N days, hh:mm:ss".

Dependent item asterisk.uptime

Preprocessing

  • JSON Path: $.uptime

Uptime after reload

System uptime after a config reload in 'N days, hh:mm:ss' format.

Dependent item asterisk.uptime_reload

Preprocessing

  • JSON Path: $.uptime_reload

Active channels

The number of active channels at the moment.

Dependent item asterisk.active_channels

Preprocessing

  • JSON Path: $.active_channels

Active calls

The number of active calls at the moment.

Dependent item asterisk.active_calls

Preprocessing

  • JSON Path: $.active_calls

Calls processed

The number of calls processed after the last service restart.

Dependent item asterisk.calls_processed

Preprocessing

  • JSON Path: $.calls_processed

Calls processed per second

The number of calls processed per second.

Dependent item asterisk.calls_processed.rate

Preprocessing

  • JSON Path: $.calls_processed

  • Change per second
Total queues

The number of configured queues.

Dependent item asterisk.total_queues

Preprocessing

  • JSON Path: $.queue.total

SIP monitored online

The number of monitored online SIP peers.

Dependent item asterisk.sip.monitored_online

Preprocessing

  • JSON Path: $.sip.monitored_online

SIP monitored offline

The number of monitored offline SIP peers.

Dependent item asterisk.sip.monitored_offline

Preprocessing

  • JSON Path: $.sip.monitored_offline

SIP unmonitored online

The number of unmonitored online SIP peers.

Dependent item asterisk.sip.unmonitored_online

Preprocessing

  • JSON Path: $.sip.unmonitored_online

SIP unmonitored offline

The number of unmonitored offline SIP peers.

Dependent item asterisk.sip.unmonitored_offline

Preprocessing

  • JSON Path: $.sip.unmonitored_offline

SIP peers

The total number of SIP peers.

Dependent item asterisk.sip.total

Preprocessing

  • JSON Path: $.sip.total

SIP trunks active channels

The total number of SIP trunks active channels.

Dependent item asterisk.sip.active_channels

Preprocessing

  • JSON Path: $.sip.active_channels

IAX online peers

The number of online IAX peers.

Dependent item asterisk.iax.online

Preprocessing

  • JSON Path: $.iax.online

IAX offline peers

The number of offline IAX peers.

Dependent item asterisk.iax.offline

Preprocessing

  • JSON Path: $.iax.offline

IAX unmonitored peers

The number of unmonitored IAX peers.

Dependent item asterisk.iax.unmonitored

Preprocessing

  • JSON Path: $.iax.unmonitored

IAX peers

The total number of IAX peers.

Dependent item asterisk.iax.total

Preprocessing

  • JSON Path: $.iax.total

IAX trunks active channels

The total number of IAX trunks active channels.

Dependent item asterisk.iax.active_channels

Preprocessing

  • JSON Path: $.iax.active_channels

PJSIP available endpoints

The number of available PJSIP peers.

Dependent item asterisk.pjsip.available

Preprocessing

  • JSON Path: $.pjsip.available

PJSIP unavailable endpoints

The number of unavailable PJSIP peers.

Dependent item asterisk.pjsip.unavailable

Preprocessing

  • JSON Path: $.pjsip.unavailable

PJSIP endpoints

The total number of PJSIP peers.

Dependent item asterisk.pjsip.total

Preprocessing

  • JSON Path: $.pjsip.total

PJSIP trunks active channels

The total number of PJSIP trunks active channels.

Dependent item asterisk.pjsip.active_channels

Preprocessing

  • JSON Path: $.pjsip.active_channels

Triggers

Name Description Expression Severity Dependencies and additional info
Service is down last(/Asterisk by HTTP/net.tcp.service["tcp","{$AMI.HOST}","{$AMI.PORT}"])=0 Average Manual close: Yes
Service response time is too high min(/Asterisk by HTTP/net.tcp.service.perf["tcp","{$AMI.HOST}","{$AMI.PORT}"],5m)>{$AMI.RESPONSE_TIME.MAX.WARN} Warning Manual close: Yes
Depends on:
  • Service is down
Version has changed

The Asterisk version has changed. Acknowledge to close the problem manually.

last(/Asterisk by HTTP/asterisk.version,#1)<>last(/Asterisk by HTTP/asterisk.version,#2) and length(last(/Asterisk by HTTP/asterisk.version))>0 Info Manual close: Yes
Host has been restarted

Uptime is less than 10 minutes.

last(/Asterisk by HTTP/asterisk.uptime)<10m Info Manual close: Yes
Failed to fetch AMI page

Zabbix has not received any data for items for the last 30 minutes.

nodata(/Asterisk by HTTP/asterisk.uptime,30m)=1 Warning Manual close: Yes
Depends on:
  • Service is down
has been reloaded

Uptime is less than 10 minutes.

last(/Asterisk by HTTP/asterisk.uptime_reload)<10m Info Manual close: Yes
Total number of active channels of SIP trunks is too high

The SIP trunks may not be able to process new calls.

min(/Asterisk by HTTP/asterisk.sip.active_channels,10m)>={$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"SIP"} Warning
Total number of active channels of IAX trunks is too high

The IAX trunks may not be able to process new calls.

min(/Asterisk by HTTP/asterisk.iax.active_channels,10m)>={$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"IAX"} Warning
Total number of active channels of PJSIP trunks is too high

The PJSIP trunks may not be able to process new calls.

min(/Asterisk by HTTP/asterisk.pjsip.active_channels,10m)>={$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"PJSIP"} Warning

LLD rule SIP peers discovery

Name Description Type Key and additional info
SIP peers discovery Dependent item asterisk.sip_peers.discovery

Preprocessing

  • JSON Path: $.sip.trunks

  • Discard unchanged with heartbeat: 1h

Item prototypes for SIP peers discovery

Name Description Type Key and additional info
SIP trunk "{#OBJECTNAME}": Get SIP trunk

Raw data for a SIP trunk.

Dependent item asterisk.sip.trunk.get[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.sip.trunks[?(@.ObjectName=='{#OBJECTNAME}')].first()

SIP trunk "{#OBJECTNAME}": Status

SIP trunk status. Here are the possible states that a device state may have:

Unmonitored

UNKNOWN

UNREACHABLE

OK

Dependent item asterisk.sip.trunk.status[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.Status

  • Discard unchanged with heartbeat: 1h

SIP trunk "{#OBJECTNAME}": Active channels

The total number of active SIP trunk channels.

Dependent item asterisk.sip.trunk.active_channels[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.active_channels

Trigger prototypes for SIP peers discovery

Name Description Expression Severity Dependencies and additional info
SIP trunk "{#OBJECTNAME}": SIP trunk {#OBJECTNAME} has a state {ITEM.VALUE}

The SIP trunk is unable to establish a connection with a neighbor due to network issues or incorrect configuration.

last(/Asterisk by HTTP/asterisk.sip.trunk.status[{#OBJECTNAME}])="UNKNOWN" or last(/Asterisk by HTTP/asterisk.sip.trunk.status[{#OBJECTNAME}])="UNREACHABLE" Average
SIP trunk "{#OBJECTNAME}": Number of the SIP trunk "{#OBJECTNAME}" active channels is too high

The SIP trunk may not be able to process new calls.

min(/Asterisk by HTTP/asterisk.sip.trunk.active_channels[{#OBJECTNAME}],10m)>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} Warning

LLD rule IAX peers discovery

Name Description Type Key and additional info
IAX peers discovery Dependent item asterisk.iax_peers.discovery

Preprocessing

  • JSON Path: $.iax.trunks

  • Discard unchanged with heartbeat: 1h

Item prototypes for IAX peers discovery

Name Description Type Key and additional info
IAX trunk "{#OBJECTNAME}": Get IAX trunk

Raw data for an IAX trunk.

Dependent item asterisk.iax.trunk.get[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.iax.trunks[?(@.ObjectName=='{#OBJECTNAME}')].first()

IAX trunk "{#OBJECTNAME}": Status

IAX trunk status. Here are the possible states that a device state may have:

Unmonitored

UNKNOWN

UNREACHABLE

OK

Dependent item asterisk.iax.trunk.status[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.Status

  • Discard unchanged with heartbeat: 1h

IAX trunk "{#OBJECTNAME}": Active channels

The total number of active IAX trunk channels.

Dependent item asterisk.iax.trunk.active_channels[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.active_channels

Trigger prototypes for IAX peers discovery

Name Description Expression Severity Dependencies and additional info
IAX trunk "{#OBJECTNAME}": IAX trunk {#OBJECTNAME} has a state {ITEM.VALUE}

The IAX trunk is unable to establish a connection with a neighbor due to network issues or incorrect configuration.

last(/Asterisk by HTTP/asterisk.iax.trunk.status[{#OBJECTNAME}])="UNKNOWN" or last(/Asterisk by HTTP/asterisk.iax.trunk.status[{#OBJECTNAME}])="UNREACHABLE" Average
IAX trunk "{#OBJECTNAME}": Number of the IAX trunk "{#OBJECTNAME}" active channels is too high

The IAX trunk may not be able to process new calls.

min(/Asterisk by HTTP/asterisk.iax.trunk.active_channels[{#OBJECTNAME}],10m)>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} Warning

LLD rule PJSIP endpoints discovery

Name Description Type Key and additional info
PJSIP endpoints discovery Dependent item asterisk.pjsip_endpoints.discovery

Preprocessing

  • JSON Path: $.pjsip.trunks

  • Discard unchanged with heartbeat: 1h

Item prototypes for PJSIP endpoints discovery

Name Description Type Key and additional info
PJSIP trunk "{#OBJECTNAME}": Get PJSIP trunk

Raw data for a PJSIP trunk.

Dependent item asterisk.pjsip.trunk.get[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.pjsip.trunks[?(@.ObjectName=='{#OBJECTNAME}')].first()

PJSIP trunk "{#OBJECTNAME}": Device state

PJSIP trunk status. Here are the possible states that a device state may have:

Unavailable

Not in use

In use

Dependent item asterisk.pjsip.trunk.devicestate[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.DeviceState

  • Discard unchanged with heartbeat: 1h

PJSIP trunk "{#OBJECTNAME}": Active channels

The total number of active PJSIP trunk channels.

Dependent item asterisk.pjsip.trunk.active_channels[{#OBJECTNAME}]

Preprocessing

  • JSON Path: $.active_channels

Trigger prototypes for PJSIP endpoints discovery

Name Description Expression Severity Dependencies and additional info
PJSIP trunk "{#OBJECTNAME}": PJSIP trunk {#OBJECTNAME} has a state Unavailable

The PJSIP trunk is unable to establish a connection with a neighbor due to network issues or incorrect configuration.

last(/Asterisk by HTTP/asterisk.pjsip.trunk.devicestate[{#OBJECTNAME}])="Unavailable" Average
PJSIP trunk "{#OBJECTNAME}": Number of the PJSIP trunk "{#OBJECTNAME}" active channels is too high

The PJSIP trunk may not be able to process new calls.

min(/Asterisk by HTTP/asterisk.pjsip.trunk.active_channels[{#OBJECTNAME}],10m)>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} Warning

LLD rule Queues discovery

Name Description Type Key and additional info
Queues discovery Dependent item asterisk.queues.discovery

Preprocessing

  • JSON Path: $.queue.queues

  • Discard unchanged with heartbeat: 1h

Item prototypes for Queues discovery

Name Description Type Key and additional info
"{#QUEUE}": Get queue

Raw data for a queue.

Dependent item asterisk.queue.get[{#QUEUE}]

Preprocessing

  • JSON Path: $.queue.queues[?(@.Queue=='{#QUEUE}')].first()

"{#QUEUE}": Logged in

The number of queue members.

Dependent item asterisk.queue.loggedin[{#QUEUE}]

Preprocessing

  • JSON Path: $.LoggedIn

"{#QUEUE}": Available

The number of available queue members.

Dependent item asterisk.queue.available[{#QUEUE}]

Preprocessing

  • JSON Path: $.Available

"{#QUEUE}": Callers

The number incoming calls in queue.

Dependent item asterisk.queue.callers[{#QUEUE}]

Preprocessing

  • JSON Path: $.Callers

Trigger prototypes for Queues discovery

Name Description Expression Severity Dependencies and additional info
"{#QUEUE}": Number of callers in the queue "{#QUEUE}" is too high

There is a large number of calls in the queue.

min(/Asterisk by HTTP/asterisk.queue.callers[{#QUEUE}],10m)>{$AMI.QUEUE_CALLERS.MAX.WARN:"{#QUEUE}"} Warning

Feedback

Please report any issues with the template at https://support.zabbix.com

You can also provide feedback, discuss the template, or ask for help at ZABBIX forums

Не нашли то, что искали?